package strategy;

public class CashContext {
    private CashStrategy strategy;

    // 初始化时，传入策略对象
    public CashContext(CashStrategy strategy) {
        this.strategy = strategy;
    }

    // 上下文接口
    public double getResult(double price, int num) {
        return this.strategy.acceptCash(price, num);
    }
}
